//
//  ImageActionBarView.h
//  ImageEnginePlugin
//
//  Created by VNG on 10/18/12.
//
//

#import <Foundation/Foundation.h>
#import "ImageMenuBarView.h"

#define kActionBarModeButton 0
#define kKindButtonActionAction 1
#define kLeftSpace 0
#define kActionBarModeSegmentButton 1
#define kKindButtonActionHasBarItem 2
#define kTagLeft 1000
#define kTagRight 1001

@protocol ImageActionBarViewDelegate

- (void)finishedActionSelected:(id)sender
                   indexSelect:(int)indexSelected;
- (void)finishedActionSubItemSelected:(id)sender
                          indexSelect:(int)indexSelected
                   indexSubItemSelect:(int)indexSubItemSelect;
@optional
- (void)slideValueChange:(NSInteger)newValue
           atIndexSelect:(int)indexSelected;
- (void)beganActionSelected:(id)sender
                indexSelect:(int)indexSelected;
@end

@interface ImageActionBarView : UIScrollView<ImageMenuBarViewDelegate>
{
    NSInteger itemSelected;//0: for Left, 1:For Right, Other: iIndex + 2
    NSInteger itemSubSelected;
    NSInteger kindActionBar;
    NSInteger numButton;
    
    NSObject<ImageActionBarViewDelegate> *delegate;
        
    NSMutableArray* arrayKindButton;
    NSMutableArray* arrayIndexBarItemInSelfView;
    
    CGSize sizeButton;
    CGRect frameSelfNormal;
    CGRect frameMainNormal;
    
    BOOL isEffectIn;
    BOOL isCancelEffect;
    
    UIButton* leftButton;
    UIButton* rightButton;
}

@property (nonatomic, assign) BOOL isCancelEffect;
@property (nonatomic, retain) UIButton* leftButton;
@property (nonatomic, retain) UIButton* rightButton;

-(id)initWithKindButton:(NSInteger)_number
            spaceButton:(NSInteger)_space
            imageNormal:(NSArray*)_arrayImage
         imagesSelected:(NSArray *)_arrayImageSelect
             sizeButton:(CGSize)_sizeButton
                  frame:(CGRect)_frame
        imageBackground:(UIImage*)_image
               delegate:(NSObject <ImageActionBarViewDelegate> *)_otherDelegate;

-(id)initWithKindSegmentButton:(NSInteger)_num
                         names:(NSArray*)_arrayName
                   imageNormal:(NSArray*)_arrayImage
                imagesSelected:(NSArray *)_arrayImageSelect
                    sizeButton:(CGSize)_sizeButton
                         frame:(CGRect)_frame
               imageBackground:(UIImage*)_image
                      delegate:(NSObject <ImageActionBarViewDelegate> *)_otherDelegate;

-(void)addLeftRightButton:(UIView*) mainview mainFrame:(CGRect)frame;
-(void)effectTranslationIn;
-(void)effectTranslationOut;
-(void)setItemSelectedAtIndex:(NSInteger)index;
-(void)buttonSelect:(id)sender;
-(void)segmentChanged:(id)sender;
-(void)refreshBar;
-(void)progessFinishedDownload;
-(void)upDateRightButtonState:(bool)enable;
-(NSString *)getStringLayerAtButtonIndex:(NSInteger)subIndex
                     atButtonActionIndex:(int)index;
- (void)updateImageButtonAtIndex:(int)index
                     imageButton:(UIImage*)image;
- (void)updateBackgroundImageButtonAtIndex:(int)index
                               imageButton:(UIImage*)image;
- (UIButton*)buttonAtIndex:(int)index;
- (void) setFrame:(CGRect)frame forButtonIndex:(int)index;
- (CGRect) frameOfButtonIndex:(int)index;

@end
